<template>
  <div>这是about页面</div>
  <button @click="fn">btn</button>
  <button @click="fn2">btn</button>
</template>

<script>
//todo  useRoute方法只能在setup的顶层调用
import { useRoute, useRouter } from "vue-router";
export default {
  setup() {
    // console.log()

    const route = useRoute();
    const router = useRouter();
    // console.log(route.params.id);

    const fn = () => {
      // const route = useRoute();
      console.log(route.params.id);
    };

    const fn2 = () => {
      router.push("/home");
    };

    return { fn, fn2 };
  },
};
</script>
